package com.itheima.consumer.config;

import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;


/**
 * @author db
 * @version 1.0
 * @description MessageConfig
 * @since 2023/12/5
 */
@Configuration
public class MessageConfig {

    @Bean
    public Queue objectQueue(){
        return new Queue("object.queue");
    }

//    @Bean
//    public Queue lazyQueue(){
//        return QueueBuilder
//                .durable("lazy.queue")
//                .lazy() // 开启Lazy模式
//                .build();
//    }

    @Bean
    public MessageConverter messageConverter(){
        return new Jackson2JsonMessageConverter();
    }
}
